package com.xiaoxiong.gobang.ui;

import com.xiaoxiong.gobang.ai.FirstAi;
import com.xiaoxiong.gobang.bean.ComputerPlayer;
import com.xiaoxiong.gobang.bean.GameState;
import com.xiaoxiong.gobang.bean.HumanPlayer;
import com.xiaoxiong.gobang.bean.Player;
import com.xiaoxiong.gobang.control.GameControl;
import com.xiaoxiong.gobang.control.PutChessControl;
import com.xiaoxiong.gobang.evaluate.FirstEvaluate;

/**
 * @author xiaoxiong
 * @Package com.xiaoxiong.gobang.ui
 * @Description:测试
 * @email 249900679@qq.com
 * @date 2016/4/2 0:42
 */
public class Test {
    private FirstAi firstAi;
    private HumanPlayer human;
    private ComputerPlayer computer;
    private FirstEvaluate firstEvaluate;
    private GameState init_state;
    private GameControl gameControl;
    private PutChessControl putChessControl;

    public void Init(){
        firstAi = new FirstAi();

        human = new HumanPlayer("小熊");
        computer = new ComputerPlayer("AI");
        computer.SetSearcher(firstAi, 2);

        firstEvaluate = new FirstEvaluate();

        init_state = new GameState();
        init_state.InitGameState(Player.FIRSTPLAYER);
        init_state.set_evaluator(firstEvaluate);

        putChessControl = new PutChessControl();
        putChessControl.setGameState(init_state);

        gameControl = new GameControl();
        gameControl.setPlayers(human, Player.SECONDPLAYER);
        gameControl.setPlayers(computer, Player.FIRSTPLAYER);
        gameControl.setChessPosition(putChessControl);
        gameControl.InitGameState(init_state);
        gameControl.Run();
    }

    public void setPos(int p){
        human.setPos(p);
    }
}
